//
// Created by Amon on 2021/10/16.
//

#ifndef AMONPLAYER_CRASHANALYSER_H
#define AMONPLAYER_CRASHANALYSER_H
#include "JNIBridge.h"
#include "Utils.h"
#include "CrashDefine.h"
#include <pthread.h>
#include <stdlib.h>

typedef struct _native_handler_context {
    int code;
    siginfo_t *si;
    void *sc;
    pid_t pid;
    pid_t tid;
    const char *process_name;
    const char *thread_name;
    int frame_size;
    uintptr_t frames[BACKTRACK_FRAMES_MAX];
}native_handler_context;

extern void init_condition();

extern void* thread_crash_monitor(void *argv);

void analysis_native_exception();

void wait_for_signal();

extern void notify_thread_exception(int signal_num, struct siginfo *si, void *sc);

#endif //AMONPLAYER_CRASHANALYSER_H
